﻿using System;
using System.Runtime.InteropServices;

namespace GLDotNet.WinForms
{
    internal static class WGL
    {
        private const string Library = "opengl32.dll";

        [DllImport(Library, EntryPoint = "wglCreateContext", ExactSpelling = true)]
        internal static extern IntPtr CreateContext(IntPtr hDc);

        [DllImport(Library, EntryPoint = "wglDeleteContext", ExactSpelling = true)]
        internal static extern bool DeleteContext(IntPtr oldContext);

        [DllImport(Library, EntryPoint = "wglGetProcAddress", ExactSpelling = true)]
        internal static extern IntPtr GetProcAddress(string lpszProc);

        [DllImport(Library, EntryPoint = "wglMakeCurrent", ExactSpelling = true)]
        internal static extern bool MakeCurrent(IntPtr hDc, IntPtr newContext);

        [DllImport(Library, EntryPoint = "wglSwapBuffers", ExactSpelling = true)]
        internal static extern bool SwapBuffers(IntPtr hdc);

        internal delegate IntPtr CreateContextAttribsARB(IntPtr hDC, IntPtr hShareContext, int[] attribList);        

        internal const uint ContextFlagsArb = 0x2094;

        internal const ulong ContextForwardCompatibleBitArb = 0x00000002;

        internal const uint ContextMajorVersionArb = 0x2091;

        internal const uint ContextMinorVersionArb = 0x2092;
    }
}
